package com.chenjj.java.rmi.registry;

import com.chenjj.java.business.order.OrderInfoVO;

import java.rmi.NotBoundException;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

public class RegistryClient {
    public static void main(String[] args) {
        try {
            Registry registry = LocateRegistry.getRegistry("127.0.0.1",1099);
            RegistryService.HelloRegistryFacade hello = (RegistryService.HelloRegistryFacade) registry.lookup("HelloRegistry");

            OrderInfoVO vo = new OrderInfoVO();
            vo.setMoney(10);
            String response = hello.helloWorld("Chenjj",vo);

            System.out.println("=======> " + response + " <=======");
        } catch (NotBoundException e) {
            e.printStackTrace();
        } catch (RemoteException e) {
            e.printStackTrace();
        }
    }
}
